package cn.edu.nwafu.hjpg.service.impl;


import cn.edu.nwafu.hjpg.dao.*;
import cn.edu.nwafu.hjpg.entity.*;
import cn.edu.nwafu.hjpg.service.LhsxbService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LhsxbServiceImpl implements LhsxbService {
    final LhsxbDao lhsxbDao;

    public LhsxbServiceImpl(LhsxbDao lhsxbDao) {
        this.lhsxbDao = lhsxbDao;
    }

    @Override
    public List<Lhsxb> findByIdAndFlagInLhsxb(String id,String name,String flag) {
        return lhsxbDao.findElementByBaseinfoWzbmAndAttributeAndFlag(id,name,flag);
    }
    @Override
    public List<Lhsxb> findAll() {
        return lhsxbDao.findAll();
    }
    @Override
    public String addElement(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getBaseinfoWzbm();
    }

    @Override
    public String addJbxz(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addFd(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addSrjd(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addBhzqy(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addRd(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addXdmd(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addSd(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addHlcs(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addLogkow(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addKoc(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addJlcs(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addRsx(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addYhx(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addBzx(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addBmzl(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String addPh(Lhsxb lhsxb) {
        return lhsxbDao.insert(lhsxb).getId();
    }

    @Override
    public String updateLhsxb(Lhsxb lhsxb) {
        return lhsxbDao.save(lhsxb).getId();
    }

    @Override
    public Page<?> findAddRecordLhsxb(String flag, Pageable pageable) {
        return lhsxbDao.findAllByflag(flag,pageable);
    }

    @Override
    public String addupdateFlag(Lhsxb lhsxb) {
        return lhsxbDao.save(lhsxb).getId();
    }

    @Override
    public void deladdRecordlhsxb(Lhsxb lhsxb) {
         lhsxbDao.delete(lhsxb);
    }

    @Override
    public List<Lhsxb> findAllByBaseinfoWzbmAndFlag(String id,String flag) {
        return  lhsxbDao.findAllByBaseinfoWzbmAndFlag(id,flag);
    }

    @Override
    public Page<?> findByPageLhsxb(String id,String attribute, int flag, Pageable pageable) {
        return lhsxbDao.findAllByflagAndAttribute(id,attribute,flag,pageable);
    }




}

